
import request from '@/utils/request'

/**
 * [sendChat 发送登录短信]
 *
 * @return  {[string]}  [return 验证码]
 */
export function sendChat(user_phone) {
  return request({
    url: '/sms/login',
    method: 'post',
    data: { user_phone }
  })
}

/**
 * [codeLogin 验证码登录]
 *
 */
export function codeLogin(form) {
  const data = {
    auth_identify: form.auth_identify ? form.auth_identify : undefined,
    code: form.code ? form.code : undefined,
    register_channel: form.register_channel ? form.register_channel : form._channel,
    invite_code: form.invite_code ? form.invite_code : undefined
  }
  return request({
    url: '/auth/code-login',
    method: 'post',
    data: { ...data }
  })
}

//  登录用户信息
export function userInfo(token) {
  return request({
    url: '/user/info',
    method: 'get',
    params: {
      token
    }
  })
}
